//
//  UILabel+Lable.m
//  SinaBlog_OC
//
//  Created by macs on 15/11/16.
//  Copyright © 2015年 BlackTail. All rights reserved.
//

#import "UILabel+Lable.h"

@implementation UILabel (Lable)

- (instancetype)initWithTitle:(NSString *)title
                        Color:(UIColor *)color
                         Font:(CGFloat)size
                       Margin:(CGFloat)margin {

  if (self = [super init]) {
    self.textAlignment = NSTextAlignmentCenter;
    self.font = [UIFont systemFontOfSize:size];
    self.text = title;
    self.textColor = color;
    if (margin != 0) {
      self.preferredMaxLayoutWidth = kScreenW - 2 * margin;
      self.textAlignment = NSTextAlignmentLeft;
    }
    self.numberOfLines = 0;
    [self sizeToFit];
  }
  return self;
}

@end
